package com.wego.service.impl;

import com.github.pagehelper.Page;
import com.github.pagehelper.PageHelper;
import com.wego.common.base.impl.BaseServiceImpl;
import com.wego.common.bean.PageBean;
import com.wego.entity.domain.Comment;
import com.wego.entity.query.CommentQuery;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;
import com.wego.mapper.CommentMapper;
import com.wego.service.CommentService;
@Service
public class CommentServiceImpl extends BaseServiceImpl<Comment> implements CommentService {
    @Autowired
    private CommentMapper commentMapper;

    @Override
    public PageBean<Comment> selectPage(CommentQuery commentQuery) {
        //设置分页信息
        Page<Comment> page = PageHelper.startPage(commentQuery.getPageNum(), commentQuery.getPageSize());
        //查询数据
        commentMapper.selectList(commentQuery);
        //将MyBatis提供的Page对象转换成我们自己的PageBean对象
        PageBean<Comment> pageBean = new PageBean<>(page);

        return pageBean;
    }

}